﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}
@* 商品采购价格 *@
<link href="~/lib/layui/css/layui.css" rel="stylesheet" />
<script src="~/lib/layui/layui.js"></script>
<script src="~/js/js.cookie.js"></script>
<script src="~/js/moment.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>
<!DOCTYPE html>
<html>
@* <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Demo</title>
    <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
    <link href="//unpkg.com/layui@2.9.18/dist/css/layui.css" rel="stylesheet">
</head> *@
<body>

    <form class="layui-form" action="">
     

        <table class="layui-table">
            <thead>
                <tr>
                    <td>商品名称</td>
                    <td>规格</td>
                    <td>计量单位</td>
                    <td>开票价格</td>
                    <td>结算价</td>
                    <td>折扣</td>

                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        <input type="text" id="goodsName" class="layui-input">
                    </td>
                    <td>
                        <input type="text" id="gguige" class="layui-input">
                    </td>

                    <td><input type="text" id="gdanwei" class="layui-input"></td>
                    <td>
                        <input type="text" id="gEmoney" class="layui-input">
                    </td>
                    <td> <input type="text" id="gSmoney" class="layui-input"></td>
                    <td> <input type="text" id="gZhek" class="layui-input"></td>
                </tr>
            </tbody>

            审核：--- &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp财务：---   &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp  制单：---
        </table>

        <div class="layui-form-item">
            <button type="button" class="layui-btn" lay-submit lay-filter="demo1">保存</button>

        </div>
    </form>


    <!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
@*     <script src="//unpkg.com/layui@2.9.18/dist/layui.js"></script> *@


</body>

</html>
<script>
    layui.use('form', function () {
        var table = layui.table;
        var form = layui.form;
        var layer = layui.layer;


        form.on('submit(demo1)', function (d) { 
            var data = {
                goodsName: $("#goodsName").val(),
                gguige: $("#gguige").val(),
                gEmoney: $("#gEmoney").val(),
                gSmoney: $("#gSmoney").val(),
                gsummoney: $("#gsummoney").val(),
                gdanwei: $("#gdanwei").val(),
            }

            $.ajax({
                url: "http://localhost:5269/api/Vendor/CreateGPprice",
                type: 'post',
                data: JSON.stringify(data),
                dataType: "json",
                contentType: "application/json",
                success: res => {
                    if (res.code == 0) {
                        layer.msg('添加成功')
                    }
                    else {
                        layer.msg('保存失败')
                    }
                }
            })
        })
        
    })
</script>